Add which-key-manual-update
authorJustin Burkett <justin@burkett.cc>
Wed, 31 Jul 2019 16:12:32 +0000 (12:12 -0400)
committerJustin Burkett <justin@burkett.cc>
Wed, 31 Jul 2019 16:15:26 +0000 (12:15 -0400)
Intended to be used for prefix-help-command

Ref #66

which-key.el

index c47c576e55e678e217b84e147f56afe74955a8d6..703d9f589122cee38bfed5161fd82a5c4ff0edab 100644 (file)
@@ -2583,6 +2583,23 @@ Finally, show the buffer."
                           (kbd which-key--god-mode-key-string))))
     this-command-keys))
 
+;;;###autoload
+(defun which-key-manual-update ()
+  "Force which-key update.
+
+This command is intended to be used for `prefix-help-command', as
+follows
+
+\(setq prefix-help-command 'which-key-manual-update).
+
+This should be set after activating `which-key-mode'."
+  (interactive)
+  (let* ((current-prefix
+          (butlast
+           (listify-key-sequence (which-key--this-command-keys)))))
+    (which-key-reload-key-sequence current-prefix)
+    (which-key--start-timer 0 t)))
+
 (defun which-key--update ()
   "Function run by timer to possibly trigger
 `which-key--create-buffer-and-show'."